package com.yxq.mdt.app.modules.logistics.ui;

import android.graphics.Color;

import androidx.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.yxq.mdt.app.R;
import com.yxq.mdt.app.modules.logistics.bean.LogisticsBean;
import com.yxq.mdt.app.modules.order.bean.ExpressBean;

import java.util.List;

/**
 * @author L
 * @time 2019-11-04
 * @describe 物流数据适配器$
 */
public class LogisticsAdapter extends BaseQuickAdapter<ExpressBean.ListBean, BaseViewHolder> {
    public LogisticsAdapter(int layoutResId, @Nullable List<ExpressBean.ListBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, ExpressBean.ListBean item) {

        if (helper.getAdapterPosition() == 0) {
            helper.setTextColor(R.id.logistics_tv_log, Color.parseColor("#56AB68"));
            helper.setTextColor(R.id.logistics_tv_date, Color.parseColor("#56AB68"));
            helper.setImageResource(R.id.logistics_iv_icon, R.drawable.green_thumb);
        } else {
            helper.setTextColor(R.id.logistics_tv_log, Color.parseColor("#666666"));
            helper.setTextColor(R.id.logistics_tv_date, Color.parseColor("#666666"));
            helper.setImageResource(R.id.logistics_iv_icon, R.drawable.gray_thumb);
        }
        helper.setText(R.id.logistics_tv_log, item.getAcceptStation());
        helper.setText(R.id.logistics_tv_date, item.getAcceptTime());
    }
}
